package bat.ke.qq.com.tx.service.impl;

import bat.ke.qq.com.tx.bean.TransferRecord;
import bat.ke.qq.com.tx.dao.TransferRecordMapper;
import bat.ke.qq.com.tx.service.AccountService;
import bat.ke.qq.com.tx.service.TransferRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 * 源码学院-Fox
 * 只为培养BAT程序员而生
 * http://bat.ke.qq.com
 * 往期视频加群:516212256 暗号:6
 */
@Service
public class TransferRecordServiceImpl implements TransferRecordService {

    @Autowired
    private TransferRecordMapper transferRecordMapper;

    @Autowired
    private AccountService accountService;

    @Override
    @Transactional(propagation = Propagation.REQUIRES_NEW)
    public void transfer(String out, String in, int amount,int mark) {

        // 保存转账记录
        transferRecordMapper.insert(new TransferRecord(out, in, amount,mark));

    }
}
